new Handle:g_Weapon = INVALID_HANDLE

new String:weapon_ents[][] = { "weapon_crowbar", "weapon_physcannon", "weapon_pistol", "weapon_357"
	,"weapon_shotgun", "weapon_smg1", "weapon_ar2", "weapon_frag", "weapon_rpg", "weapon_slam" 
	,"weapon_stunstick", "weapon_crossbow", "weapon_mp5k", "weapon_mg1", "weapon_bugbait" }

//-------------------------//
// Weapon in use? (caring) //
//-------------------------//
bool:WeaponHasOwner(weapon)
{	
	if (GetEntPropEnt(weapon, Prop_Data, "m_hOwner") == -1)
	{
		return false
	} 
	else 
	{
		return true
	}
}

//--------------------------------------//
// Here we check if the weapon is valid //
//--------------------------------------//
bool:IsWeapon(weapon)
{
	new String:weaponclass[32]
	GetEdictClassname(weapon, weaponclass, sizeof(weaponclass))

	for (new i=0;i<sizeof(weapon_ents);i++)
	{
		if (StrEqual(weaponclass,weapon_ents[i],false))
		{
			return true
		}
	}
	return false
}

//-------------------------------//
// Found the Name of the weapon? //
//-------------------------------//
bool:IsWeaponname(weapon)
{
	new String:weaponname[32]
	GetEntPropString(weapon, Prop_Data, "m_iName", weaponname, sizeof(weaponname))

	if (StrEqual(weaponname,"wep_dropped_1234",false))
	{
		return true
	}
	else
	{
		return false
	}
}

//-------------------------//
// On Weapon Drop function //
//-------------------------//
public Action:OnWeaponDrop(client, weapon)
{
	if (GetConVarInt(g_Weapon) == 0)
		return Plugin_Continue
	
	if ((weapon <= 0) || !IsValidEntity(weapon))
		return Plugin_Continue

	DispatchKeyValue(weapon, "targetname", "wep_dropped_1234")

	new Float:i_Timer = GetConVarFloat(g_Weapon)
	if (i_Timer > 0)
		CreateTimer(i_Timer, TimerKillWeapon, weapon)

	return Plugin_Continue
}

//----------------------------------------------//
// Here we kill the weapon if all checks passed //
//----------------------------------------------//
public Action:TimerKillWeapon(Handle:timer, any:weapon)
{
	if ((weapon <= 0) || !IsValidEntity(weapon)){
		return Plugin_Handled
	}

	if (IsWeaponname(weapon) && IsWeapon(weapon) && !WeaponHasOwner(weapon))
	{
		DO_DissolvePlayer(INVALID_HANDLE, weapon)
	}
	return Plugin_Handled
}